<?php session_start(); ?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Triumph - Add New Employee</title>
        <link href="maintenancePagesCSS.css" REL="StyleSheet" TYPE="text/css" >
        <link href="CalendarControl.css"
              rel="stylesheet" type="text/css">
        <script src="Calendar.js"
        language="javascript"></script>
        <style type='text/css'>
            <!--
            body {
                background-color: #454343;
                margin-left: 17px;
                margin-top: 0px;
                margin-right: 0px;
                margin-bottom: 0px;
            }
            -->
        </style>


        <script type='text/javascript' src='tabber.js'></script>
        <link rel='stylesheet' href='triumph.css' TYPE='text/css' MEDIA='screen'>


        <script type='text/javascript'>

            /* Optional: Temporarily hide the 'tabber' class so it does not 'flash'
           on the page as plain HTML. After tabber runs, the class is changed
           to 'tabberlive' and it will appear. */

            document.write('<style type='text/css'>.tabber{display:none;}<\/style>');
        </script>



        <style type="text/css">
            <!--
            .style3 {color: #FFFFFF}
            -->
        </style>

    </head>

    <body text="#FFFFFF">
        <CENTER>
            <form action="TicketAddFunc.php" method="POST" id="ticketAddForm">
                <table id='Table_01' width='1000' height='713' border='0' cellpadding='0' cellspacing='0'>
                    <tr><td align="center" bgcolor='#454343'><h2><img src="images/TitleTicketAdd.gif" alt="Ticket Add" width="514" height="67"></h2></td></tr>
                    <TR bordercolor='#000000'>
                        <TD width="1000" height='2' bgcolor='#454343'></TD>
                    </TR>
                    <TR bordercolor='#000000'>
                        <TD height='2' bgcolor='#454343'></TD>
                    </TR>

                    <!--MAIN BODY TABLE ROW -->
                    <TR bordercolor='#000000' bgcolor='#454343'>
                        <TD height='249'>


                            <script type='text/javascript' src='tabber.js'>
                            </script>



                            <div class='tabber'>

                                <div class='tabbertab'>
                                    <h2>Ticket</h2>

                                    <center>
                                        <table>
                                            <tr>
                                                <th colspan="5" align="center">Ticket</th>
                                            </tr>
                                            <tr>
                                                <td colspan="1" align="center">Expected Complete Date:</td>
                                                <td><input type="text" readonly="true" maxlength="25" id="cmplt" name ="cmplt"></td>
                                                <td>
                                                    <img src="images/22pxCalendar.png" onClick="showCalendarControl(document.getElementById('cmplt'));" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <th colspan="5" align="center">Employee Information</th>
                                            </tr>
                                            <tr>
                                                <td align="left">Employee ID:</td>
                                                <td><input type="text"  maxlength="25" id="empid" name ="empid" readonly="true"> </td>
                                            </tr>
                                            <tr>
                                                <td align="left">First Name:</td>
                                                <td><input type="text"  maxlength="25" id="empfirst" name ="empfirst" readonly="true"></td>
                                                <td align="left">Last Name:</td>
                                                <td><input type="text"  maxlength="25" id="emplast" name ="emplast" readonly="true"></td>
                                            </tr>
                                            <tr>
                                                <td align="left">Login ID:</td>
                                                <td><input type="text"  maxlength="25" id="emplogin" name ="emplogin" readonly="true"></td>
                                                <td align="left">Role:</td>
                                                <td><input type="text"  maxlength="25" id="emprole" name ="emprole" readonly="true"></td>

                                            </tr>
                                            <tr>
                                                <td align="left">Is Deleted:</td>
                                                <td><input type="text"  maxlength="25" id="isdeleted" name ="isdeleted" readonly="true"></td>
                                                <td></td>
                                                <td align="center"><input type="button" value="Assign Employee" onClick="openEmployeeWindow();"> </td>


                                            </tr>

                                        </table>
                                    </center>
                                    <script type="text/javascript">
                                        function openEmployeeWindow()
                                        {
                                            window.showModalDialog('EmployeePopUp.php','','dialogWidth:1000px; dialogHeight:300px; center:yes');
                                        }

                                    </script>

                                </div>

                                <div class='tabbertab'>
                                    <h2>Customer Information</h2>
                                    <center>
                                        <table>
                                            <tr>
                                                <th colspan="6" align="center">Customer Information</th>
                                            </tr>
                                            <tr>
                                                <td align="left">Customer ID:</td>
                                                <td><input type="text"  maxlength="25" id="id" name ="id" readonly="true"> </td>
                                            </tr>
                                            <tr>
                                                <td align="left">First Name:</td>
                                                <td><input type="text"  maxlength="25" id="first" name ="first" readonly="true"></td>
                                                <td align="left">Last Name:</td>
                                                <td><input type="text"  maxlength="25" id="last" name ="last" readonly="true"></td>
                                            </tr>
                                            <tr>
                                                <td align="left">Address:</td>
                                                <td colspan="3"><input type="text" size="58" maxlength="45" id="addr" name ="addr" readonly="true"></td>
                                            </tr>
                                            <tr>
                                                <td align="left">City:</td>
                                                <td><input type="text"  maxlength="25" id="city" name ="city" readonly="true"></td>
                                                <td align="left">State:</td>
                                                <td><input type="text"  maxlength="25" id="state" name ="state" readonly="true"></td>
                                                <td align="left">Zip:</td>
                                                <td><input type="text"  maxlength="25" id="zip" name ="zip" readonly="true"> </td>
                                            </tr>
                                            <tr>
                                                <td align="left">Phone 1:</td>
                                                <td><input type="text"  maxlength="25" id="phone1" name ="phone1" readonly="true"></td>
                                                <td align="left">Phone 2:</td>
                                                <td><input type="text"  maxlength="25" id="phone2" name ="phone2" readonly="true"></td>
                                                <td align="left">Phone 3:</td>
                                                <td><input type="text"  maxlength="25" id="phone3" name ="phone3" readonly="true"> </td>
                                            </tr>
                                            <tr>
                                                <td align="left">Email:</td>
                                                <td><input type="text"  maxlength="25" id="email" name ="email" readonly="true"></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td align="center"><input type="button" value="Add/Change Customer" onClick="openCustomerWindow();"> </td>
                                            </tr>
                                        </table>
                                    </center>

                                    <script type="text/javascript">
                                        function openCustomerWindow()
                                        {
                                            window.showModalDialog('CustomerPopUp.php','','dialogWidth:1100px; dialogHeight:300px; center:yes');
                                        }

                                    </script>
                                </div>


                                <div class='tabbertab' dataSrc ="workDoneDiv.php">
                                    <h2>Work Done</h2>
                                    <center>
                                        <table id="workDoneTable">

                                            <tr>
                                                <th colspan="4" align="center">Work Done</th>
                                            </tr>
                                            <tr>
                                                <td>Employee Assigned</td>
                                                <td><input type="hidden" id="techID" name="techID" value="<?php print($_SESSION['userID']);?>"><input type='text' readonly='readonly'  size='25' name='techName' id='techName' value="<?php print($_SESSION['EMPFIRST']);?>"></td>
                                                <td>Notes</td>
                                                <td rowspan="3"> <textarea rows='3' cols='25' size='25' name='notes' id='wdNotes' readonly="true"></textarea></td>
                                            </tr>
                                            <tr>
                                                <td>Date</td>
                                                <td><input type='text'  size='25' name='dateDone' id='wdDateDone' readonly="true"></td>
                                            </tr>
                                            <tr>
                                                <td>Hours</td>
                                                <td><input type='text'  size='25' name='hours' id='wdHours' readonly="true"></td>
                                            </tr>

                                        </table>
                                    </center>
                                    <center>
                                        <input type="button" value="Add Work Done" onClick="workDonePopup();" />
                                    </center>

                                </div>

                                <div class='tabbertab'>

                                    <h2>Parts Used</h2>

                                    <center>
                                        <span class="divHeader">
                                            <b>Products Used</b>
                                        </span>
                                        <br/>
                                            <!--<div style="width: 95%; border:solid; border-width:1; background-color: #666666;"/>-->
                                                <table align="center">

                                                <tr align="center" style="width:10%">
                                                    <td>
                                                        ID:
                                                    </td>
                                                    <td>
                                                        <input type="text" id="pid" name="pid" readonly="readonly"/>
                                                    </td>
                                                </tr>
                                                <tr align="center" style="width:10%">
                                                    <td>
                                                        Manufacturer:
                                                    </td>
                                                    <td>
                                                        <input type="text" id="Manufac" name="Manufac" readonly="readonly"/>
                                                    </td>
                                                </tr>
                                                <tr align="center" style="width:10%">
                                                    <td>
                                                        Model Number:
                                                    </td>
                                                    <td>
                                                        <input type="text" id="ModelNum" name="ModelNum" readonly="readonly"/>
                                                    </td>
                                                </tr>
                                                <tr align="center" style="width:10%">
                                                    <td>
                                                        Serial Number:
                                                    </td>
                                                    <td>
                                                        <input type="text"  id="SerialNum" name="SerialNum" readonly="readonly"/>
                                                    </td>
                                                </tr>
                                                <tr align="center" style="width:10%">
                                                    <td>
                                                        Company Price:
                                                    </td>
                                                    <td>
                                                        <input type="text" id="CompPrice" name="CompPrice" readonly="readonly"/>
                                                    </td>
                                                </tr>
                                                <tr align="center" style="width:10%">
                                                    <td>
                                                        Customer Price:
                                                    </td>
                                                    <td>
                                                        <input type="text" id="CustPrice" name="CustPrice" readonly="readonly"/>
                                                    </td>
                                                </tr>
                                                <tr align="center" style="width:10%">
                                                    <td>
                                                        Tech Notes:
                                                    </td>
                                                    <td>
                                                        <input type="text" id="TechN" name="TechN" readonly="readonly"/>
                                                    </td>
                                                </tr>
                                            </table>
                                            <input type="button" value="Add Product" onclick="window.showModalDialog('productPopup.php', 'Add Product', 'menubar=0, toolbar=0, height=180px, width=280px');" />
                                            <input type="hidden" id="hdnID" value="" name="hdnID"/>
                                    </center>

                                </div>

                                <div class='tabbertab'>
                                    <h2>Customer Contact Log</h2>
                                    <center>
                                        <p>Customer Contact Log</p>
                                        <table>
                                            <tr>
                                                <td>
                                                    Date Contacted:
                                                </td>
                                                <td>
                                                    <input type="text" id="custContactDate" name="custContactDate" readonly="true"/>
                                                </td>
                                                <td>
                                                    <input type="button" value="Add/Edit" onClick="window.showModalDialog('CustomerContactPopup.php', null, 'dialogHeight:300px;dialogWidth:500px;dialogLeft:300;dialogTop:200');" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    Contact Notes:
                                                </td>
                                                <td colspan="2">
                                                    <textarea readonly="true" id="txtAreaCustContactNotes" name="txtAreaCustContactNotes" rows="3" cols="40"></textarea>
                                                </td>
                                            </tr>
                                        </table>
                                    </center>
                                </div>
                            </div> </TD>
                    </TR>

                    <TR bordercolor='#000000'>
                        <TD  bgcolor='#454343'><div align="center">
                                <input id="btnSubmit" type="button" value="Submit" onClick="checkForm();">
                            </div></TD>
                    </TR>
                    <TR bordercolor='#000000'>
                        <TD height='442' bgcolor='#454343'><div align="center"></div></TD>
                    </TR>



                </table>

            </form>
        </CENTER>
    </body>
    <script>
        function checkForm()
        {
            var strCheck = "Please correct the following to Create the New Ticket:";
            var strCompare = strCheck;

            strCheck += (document.getElementById("id").value == "") ? "\n -  No Customer is Assigned to the Ticket" : "";
            strCheck += (document.getElementById("empid").value == "") ? "\n -  No Employee is Assigned to the Ticket" : "";
            strCheck += (document.getElementById("cmplt").value == "") ? "\n - No Expected Completion Date is Given" : "";

            if(strCompare == strCheck)
            {
                document.getElementById("ticketAddForm").submit();
            }
            else
            {
                alert(strCheck);
            }
        }
        function checkHiddenValue()
        {
            // alert("called");
            alert(document.getElementById("wdPK1").value);
        }
        function removeLast()
        {
            table = document.getElementById("tblWorkDone");
            table.deleteRow(table.rows.length - 1);
        }
        function getBrowser()
        {
            return navigator.appName;
        }
        function workDonePopup()
        {
            if(getBrowser() == 'Microsoft Internet Explorer')
            {
                //showModalDialog does not yield a window.opener type in IE
                //stupid IE!
                window.open('WorkDonePopup.php', null, 'width=500, height=300');
            }
            else
            {
                window.showModalDialog('WorkDonePopup.php', null, 'dialogHeight:300px;dialogWidth:500px;dialogLeft:300;dialogTop:200');
            }
        }
        function editWorkDonePopup(workDoneID, rowID, editOrDelete)
        {
            if(getBrowser() == 'Microsoft Internet Explorer')
            {
                //showModalDialog does not yield a window.opener type in IE
                //stupid IE!
                window.open("EditWorkDonePopup.php?id=" + workDoneID + "&row=" + rowID + "&function=" + editOrDelete, null, 'width=500, height=300');

            }
            else
            {
                window.showModalDialog("EditWorkDonePopup.php?id=" + workDoneID + "&row=" + rowID + "&function=" + editOrDelete, null, 'dialogHeight:300px;dialogWidth:500px;dialogLeft:300;dialogTop:200');
            }
        }
    </script>
</html>
